package io.litchi.auth.Infrastructure.handler;

import io.litchi.auth.Infrastructure.constant.AuthConstant;
import jakarta.servlet.FilterChain;
import jakarta.servlet.ServletException;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import lombok.AllArgsConstructor;
import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter;

import java.io.IOException;

/**
 * description: 认证过滤器  暂时使用 spring-security的解析器
 *
 * @author helang
 * @since 2025-09-10
 */
//@Component
//@Slf4j
//@AllArgsConstructor
//public class LitchiAuthenticationFilter extends OncePerRequestFilter {
//
//    /**
//     * 认证方法
//     *
//     * @param request     http请求
//     * @param response    http响应
//     * @param filterChain 处理器
//     * @throws ServletException ex
//     * @throws IOException      ex
//     */
//    @Override
//    protected void doFilterInternal(@NonNull HttpServletRequest request, @NonNull HttpServletResponse response, @NonNull FilterChain filterChain) throws ServletException, IOException {
//        //todo 1.从请求头获取token信息
//        String requestURI = request.getRequestURI();
//        if (requestURI.startsWith(AuthConstant.NO_AUTH_PATH_PREFIX)) {
//            filterChain.doFilter(request,response);        }
//        log.info("认证校验");
//        //2.jwt校验
//
//        //3.失败(返回异常)/成功(放行)
//        filterChain.doFilter(request,response);
//    }
//}